<?php $this->extend('comm/page');?>

<div class="panel panel-default panel-intro">
    <?php echo $this->build_heading(); ?>

    <div class="panel-body">
        <!-- 搜索 -->
        <div id="search" class="row">
            <form class="layui-form" lay-filter="search">
                <div class="col-xs12 col-sm-6 col-md-3">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">用户名：</label>
                        <div class="layui-input-block">
                            <input type="text" name="username" placeholder="搜索用户名" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="col-xs12 col-sm-6 col-md-3">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">状态：</label>
                        <div class="layui-input-block">
                            <select name="status" lay-filter="status">
                                <option value=""></option>
                                <option value="1">正常</option>
                                <option value="2">冻结</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-xs12 col-sm-6 col-md-3 hidden-xs">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">登录时间：</label>
                        <div class="layui-input-block">
                            <input type="text" name="login_time" class="layui-input date-range">
                        </div>
                    </div>
                </div>
            </form>
        </div>

        <div id="toolbar" class="toolbar">
            <?php echo $this->build_toolbar(['refresh', 'add', 'search']); ?>
        </div>
        <table id="table" lay-filter="table" class="mr-b-sm"></table>
    </div>
</div>

<!-- 操作 -->
<script type="text/html" id="operate">
    <?php if($this->checkAuth('/admin/sys/auth/admin/password')): ?>
        {{# if(supper_admin.indexOf(d.id) < 0){ }}
        <button type="button" class="btn btn-xs btn-info" lay-event="password"><i class="fa fa-pencil"> 重置密码</i></button>
        {{# } }}
    <?php endif; ?>
    <?php if($this->checkAuth('/admin/sys/auth/admin/edit')): ?>
        {{# if(supper_admin.indexOf(d.id) < 0){ }}
        <button type="button" class="btn btn-xs btn-warning" lay-event="edit"><i class="fa fa-pencil"> 修改信息</i></button>
        {{# } }}
    <?php endif; ?>
    <?php if($this->checkAuth('/admin/sys/auth/admin/toggle')): ?>
        {{# if(supper_admin.indexOf(d.id) < 0){ }}
            {{# if(d.status == '1'){ }}
            <button type="button" class="btn btn-xs btn-primary" data-title="确认封冻该用户么？" data-status="2" lay-event="toggle">
                <i class="fa fa-pencil"> 封冻用户</i>
            </button>
            {{# }else{ }}
            <button type="button" class="btn btn-xs btn-primary" data-title="确认重启该用户么？" data-status="1" lay-event="toggle">
                <i class="fa fa-pencil"> 重启用户</i>
            </button>
            {{# } }}
        {{# } }}
    <?php endif; ?>
</script>

<script>window.supper_admin = JSON.parse('<?php echo $superAdmin; ?>') </script>